load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
load("//pytorch/botorch:buck_macros.bzl", "botorch_test_cpu", "botorch_test_cuda")

oncall("ae_modopt")

python_library(
    # @autodeps-skip
    name = "botorch",
    srcs = glob(["botorch/**/*.py"]),
    base_module = "",
    import_profile = True,
    deps = [
        "fbsource//third-party/pypi/multipledispatch:multipledispatch",
        "fbsource//third-party/pypi/pyro-ppl:pyro-ppl",
        "//python/wheel/scipy:scipy",
        "//pytorch/gpytorch:gpytorch",
    ],
)

python_library(
    # @autodeps-skip
    name = "test-lib",
    srcs = glob(["test/**/*.py"]),
    base_module = "botorch",
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_acquisition",
    srcs = glob(["test/acquisition/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_acquisition_cuda",
    srcs = glob(["test/acquisition/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_exceptions",
    srcs = glob(["test/exceptions/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_exceptions_cuda",
    srcs = glob(["test/exceptions/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_generation",
    srcs = glob(["test/generation/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_generation_cuda",
    srcs = glob(["test/generation/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_models",
    srcs = glob(["test/models/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_models_cuda",
    srcs = glob(["test/models/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_optim",
    srcs = glob(["test/optim/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_optim_cuda",
    srcs = glob(["test/optim/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_posteriors",
    srcs = glob(["test/posteriors/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_posteriors_cuda",
    srcs = glob(["test/posteriors/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_sampling",
    srcs = glob(["test/sampling/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_sampling_cuda",
    srcs = glob(["test/sampling/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_test_functions",
    srcs = glob(["test/test_functions/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_test_functions_cuda",
    srcs = glob(["test/test_functions/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_utils",
    srcs = glob(["test/utils/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_utils_cuda",
    srcs = glob(["test/utils/**/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cpu(
    name = "test_other",
    srcs = glob(["test/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)

botorch_test_cuda(
    name = "test_other_cuda",
    srcs = glob(["test/*.py"]),
    supports_static_listing = True,
    deps = [
        ":botorch",
    ],
)
